package com.hu.zhcc.shiro.service.Lixueseng520;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hu.zhcc.common.entity.Page;
import com.hu.zhcc.shiro.dao.LxsDietDAO;
import com.hu.zhcc.shiro.entity.bo.Lixueseng520.LxsDiet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class DietServiceImpl implements DietService {
    @Autowired
    private LxsDietDAO dao;

    @Override
    public Page<LxsDiet> findDietByPrimary(Map map, Integer offset, Integer limit) {
        PageHelper.startPage(offset,limit);
        List<LxsDiet> dietList = dao.findDietByPrimary(map);
        PageInfo<LxsDiet> info = new PageInfo<>(dietList);
        return new Page<>(info.getTotal(),dietList);
    }

    @Override
    public int insertSelective(LxsDiet record) {
        return dao.insertSelective(record);
    }

    @Override
    public int updateByPrimaryKeySelective(LxsDiet record) {
        return dao.updateByPrimaryKeySelective(record);
    }

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return dao.deleteByPrimaryKey(id);
    }
}
